export class Scale {
  source = [];
  target = [];

  constructor(src, tar) {
    this.source = src;
    this.target = tar;
  }

  get srcSize() {
    return this.source.length;
  }
  get tarSize() {
    return this.target.length;
  }
  get rate() {
    return this.tarSize / this.srcSize;
  }

  linear(sourceData) {
    const index = this.source.indexOf(sourceData);
    return this.target[Math.floor(this.rate * index)];
  }
}